/*
 * surface.cpp
 *
 *  Created on: 09 Nis 2012
 *      Author: hframe
 */

#include "surface.h"

startnamespace(androidplus)
startnamespace(ui)

surface::surface():grph(NULL){


}

surface::~surface() {
	LOGI("Surface Destroying");
    uninitialize();
	LOGI("Surface Destroyed");
}

 void  surface::initialize(ANativeWindow *window)
 {
     if(grph==NULL){
    	 grph=new graphics(window);

     }

 }
    void surface::uninitialize()
    {
      if(grph!=NULL)
    	  delete grph;
      grph=NULL;

    }
     t_int32  surface::get_height()
     {
    	 if(grph!=NULL)
    		 return grph->get_height();
    	 return 0;
     }
     t_int32  surface::get_width(){
    	 if(grph!=NULL)
    		 return grph->get_width();
    	 return 0;
     }

     void surface::flush()
     {
    	 if(grph!=NULL)
    		 grph->flush();
     }

     void surface::draw_background(){
    	 grph->draw_background(background);
     }

endnamespace(ui)
endnamespace(anroidplus)
